package com.slowly.dao;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import com.slowly.mybatis.User;

public class userImpl implements IUser {
	
	private SqlSessionFactory sqlSessionFactory;
	public userImpl(SqlSessionFactory sqlSessionFactory){
		this.sqlSessionFactory = sqlSessionFactory;
	}

	@Override
	public User findUserById(int id) {
		SqlSession session = sqlSessionFactory.openSession();
		User user = null;
		try{
			user = session.selectOne("findUserById", 1);
			System.out.println(user);
		}catch(Exception ex){
			ex.printStackTrace();
		}finally{
			session.close();
		}
		
		return user;
	}

}
